<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<div id="page-content">
    <div class="row">

        <div class="col-lg-12">
            <div class="panel">
                <div class="panel-heading">
                    <h3 class="panel-title">印章使用 - 已归档</h3>
                </div>
                <div class="panel-body">
                    
                    <div class="table-responsive">
                        <table id="seal_finish_table"></table>
                        <div id="seal_finish_page"></div>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>

<script>

    $(function(){

        init_grid_seal();

    });

    function init_grid_seal() {

        __init_jqgrid('seal_finish_table', 'seal_finish_page',
                '<%=path%>/activiti/seal/list',
                ['印章使用类型', '印章名称', '创建时间', '申请人', '印章状态', '操作', 'id'],
                [
                    {name: 'useType', index: 'useType', width: 40, sortable: false, search: false, formatter: useTypeFormat},
                    {name: 'name', index: 'name', width: 100, sortable: false, stype: 'text', searchoptions: {sopt: ['cn']}},
                    {name: 'createTime', index: 'createTime', width: 80, sortable: false, search: false},
                    {name: 'creater', index: 'creater', width: 80, sortable: false, search: false},
                    {name: 'txtStatus', index: 'txtStatus', width: 40, sortable: false, search: false},
                    {name: 'act', index: 'act', width: 150, fixed: true, sortable: false, search: false, formatter: actFormat},
                    {name: 'id', index: 'id', width: 100, key: true, hidden: true, hidedlg: true}
                ],
                true,
                {
                    postData: {catalog: 0x03}
                }
        );

    }

    function useTypeFormat(cellvalue, options, rowObject){
        if(rowObject.useType == 1){
            cellvalue = "内部使用";
        } else if(rowObject.useType == 2){
            cellvalue = "外借使用";
        }
        return cellvalue;
    }

    function actFormat(cellvalue, options, rowObject){
        var id = rowObject.id;
        cellvalue = '<button class="btn btn-white btn-sm" data-original-title="查看" onclick="fn_seal_read(\'' + id + '\');"><i class="fa fa-eye"> </i> 查看</button>';

        return cellvalue;
    }

    function fn_seal_read(id) {
        loadURL('<%=path%>/activiti/seal/read/'+id, $('#page-content'));
    }

</script>